package net.hn.hnms.biz.cockpit.controller;


import com.alibaba.fastjson.JSONObject;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import lombok.RequiredArgsConstructor;
import net.hn.hnms.biz.cockpit.domain.SituationKeyWork;
import net.hn.hnms.biz.cockpit.domain.WarnInfo;
import net.hn.hnms.biz.cockpit.domain.vo.*;
import net.hn.hnms.biz.cockpit.service.IProductionSituationService;
import net.hn.hnms.biz.cockpit.service.IWarnInfoService;
import net.hn.hnms.sys.common.core.domain.R;
import net.hn.hnms.sys.common.satoken.config.AutoSetMineCode;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;

@Api(value = "生产态势", tags = {"生产态势"})
@RestController
@RequestMapping("/cockpit/situation")
@RequiredArgsConstructor
public class ProductionSituationController {

    private final IProductionSituationService productionSituationService;

    private final IWarnInfoService warnInfoService;

    @ApiOperation("资源储量")
    @GetMapping("/resource")
    @AutoSetMineCode
    public R<ResourceReservesVo> getResource(String mineCode) {
        return R.ok(productionSituationService.getResource(mineCode));
    }

    @ApiOperation("产量")
    @GetMapping("/productStatistics")
    @AutoSetMineCode
    public R<ProductStatisticsVo> getProductStatistics(String mineCode) {
        return R.ok(productionSituationService.getProductStatistics(mineCode));
    }

    @ApiOperation("产量统计")
    @GetMapping("/productDetail")
    @AutoSetMineCode
    public R<List<ProductDetailVo>> productDetail(String mineCode) {
        return R.ok(productionSituationService.productDetail(mineCode));
    }

    @ApiOperation("进尺统计")
    @GetMapping("/drivingDetail")
    @AutoSetMineCode
    public R<List<DrivingDetailVo>> getDrivingDetail(String mineCode) {
        return R.ok(productionSituationService.getDrivingDetail(mineCode));
    }

    @ApiOperation("综合自动化-系统列表")
    @GetMapping("/systems")
    @AutoSetMineCode
    public R<List<OptionVo>> getSystems(String mineCode) {
        return R.ok(productionSituationService.getSystems(mineCode));
    }

    @ApiOperation("综合自动化-设备监测")
    @GetMapping("/deviceMonitor")
    @AutoSetMineCode
    public R<JSONObject> getDeviceMonitor(String mineCode,@RequestParam("sysCode") String sysCode) {
        return R.ok(productionSituationService.getDeviceMonitor(mineCode, sysCode));
    }

    @ApiOperation("综合自动化-监测点历史曲线")
    @GetMapping("/monitorPointLine")
    @AutoSetMineCode
    public R<JSONObject> getMonitorLine(String mineCode, String id) {
        return R.ok(productionSituationService.getMonitorLine(mineCode, id));
    }

    @ApiOperation(value = "视频监控", notes = "tag: 视频标识")
    @GetMapping("/video")
    @AutoSetMineCode
    public R<List<OptionVo>> video(String mineCode, String tag) {
        return R.ok(productionSituationService.getVideo(mineCode, tag));
    }

    @ApiOperation("管理数智化-预警信息")
    @GetMapping("/warnInfo")
    @AutoSetMineCode
    public R<List<WarnInfo>> warnInfo(String mineCode) {
        return R.ok(warnInfoService.getWarnInfo(mineCode));
    }

    @ApiOperation("管理数智化-重点工作")
    @GetMapping("/work")
    @AutoSetMineCode
    public R<List<SituationKeyWork>> work(String mineCode) {
        return R.ok(productionSituationService.getKeyWork(mineCode));
    }


    @ApiOperation("安全监测")
    @GetMapping("/monitor")
    @AutoSetMineCode
    public R<List<OptionVo>> monitor(String mineCode) {
        return R.ok(warnInfoService.getMonitorAnalyse(mineCode));
    }


}
